export class ViewRect {
  x: number
  y: number
  w: number
  h: number

  constructor(x: number, y: number, w: number, h: number) {
    this.x = x;
    this.y = y;
    this.w = w;
    this.h = h;
  }
}

export class Color4B {
  r: number
  g: number
  b: number
  a: number

  constructor(r: number, g: number, b: number, a: number) {
    this.r = r;
    this.g = g;
    this.b = b;
    this.a = a;
  }
}

export class BaseWorkerMsgEntity {
  module: string;

  function: string;

  constructor(module: string, func: string) {
    this.module = module;
    this.function = func;
  }
}

export class DialogMsgEntity extends BaseWorkerMsgEntity {
  static MODULE_NAME : string = 'Dialog';
  title: string;

  message: string;

  constructor(func: string) {
    super(DialogMsgEntity.MODULE_NAME, func);
  }
}

export class TextInputMsgEntity extends BaseWorkerMsgEntity {
  static MODULE_NAME : string = 'TextInput';
  viewTag: number

  viewRect: ViewRect

  paddingW: number
  paddingH: number

  visible: boolean
  isBold: boolean
  editable: boolean

  text: string
  fontSize: number
  color: Color4B
  fontPath: string

  placeHolderText: string
  placeHolderSize: number
  placeHolderColor: Color4B
  placeHolderFontPath: string

  maxLength: number

  align: string

  inputMode: string

  isSecure: boolean

  enterKey: string

  constructor(func: string, viewTag?: number) {
    super(TextInputMsgEntity.MODULE_NAME, func);
    this.viewTag = viewTag;
  }
}

export class TextAreaMsgEntity extends BaseWorkerMsgEntity {
  static MODULE_NAME : string = 'TextArea';
  viewTag: number

  viewRect: ViewRect

  paddingW: number
  paddingH: number

  visible: boolean
  isBold: boolean
  editable: boolean

  text: string
  fontSize: number
  color: Color4B
  fontPath: string

  placeHolderText: string
  placeHolderSize: number
  placeHolderColor: Color4B
  placeHolderFontPath: string

  maxLength: number

  align: string

  inputMode: string

  isSecure: boolean

  enterKey: string

  constructor(func: string, viewTag?: number) {
    super(TextAreaMsgEntity.MODULE_NAME, func);
    this.viewTag = viewTag;
  }
}

export class VideoPlayMsgEntity extends BaseWorkerMsgEntity {
  static MODULE_NAME: string = 'VideoPlay';
  viewTag: number

  url: string
  isUrl: number

  isLoop: boolean

  viewRect: ViewRect

  visible: boolean

  isFullScreen: boolean

  seekTo: number

  keepAspectRatioEnabled: boolean

  constructor(func: string, viewTag: number) {
    super(VideoPlayMsgEntity.MODULE_NAME, func);
    this.viewTag = viewTag;
  }
}

export class WebViewMsgEntity extends BaseWorkerMsgEntity {
  static MODULE_NAME: string = 'WebView';
  viewTag: number

  data: string
  mimeType: string
  encoding: string
  baseURL: string

  url: string

  filePath: string

  viewRect: ViewRect

  visible: boolean

  opacity: number

  js: string

  scalesPageToFit: boolean

  constructor(func: string, viewTag: number) {
    super(WebViewMsgEntity.MODULE_NAME, func);
    this.viewTag = viewTag;
  }
}

export class JumpMsgEntity extends BaseWorkerMsgEntity {
  static MODULE_NAME: string = 'JumpManager';
  targetBundleName: string;
  targetAbilityName: string;
  appId: string;
  url: string;
  pWidth: number;
  pHeight: number;

  constructor(func: string) {
    super(JumpMsgEntity.MODULE_NAME, func);
  }
}

export class DeviceUtilsMsgEntity extends BaseWorkerMsgEntity {
  static MODULE_NAME: string = 'DeviceUtils';
  isPrivacyMode: boolean;

  constructor(func: string) {
    super(DeviceUtilsMsgEntity.MODULE_NAME, func);
  }
}